package group2projman;

import java.util.Date;

class BookCopy {
	/** TODO: Fix. */
	enum Condition {
		NOT_TOO_SHABBY, REMOVED
	}
	
	/// TODO: ensure all three states are in use
	enum LoanPermission {
		REFERENCE_ONLY, LOANABLE, TEMPORARILY_UNAVAILABLE, REMOVED
	}
	
	int id;
	
	int bookId;
	
	Date addedDate;
	
	String shelfMark;
	
	Condition condition;
	
	LoanPermission loanPermission;
	
	Member loanedTo;
	
	/// If true, book is being held for Member loanedTo, but has not yet been picked up
	boolean isReserved;
		
	BookCopy(Book pBookData, Date pAddedDate, String pShelfMark, Condition pCondition, LoanPermission pLoanPermission) {
		bookId = pBookData.getId();
		addedDate = pAddedDate;
		shelfMark = pShelfMark;
		condition = pCondition;
		loanPermission = pLoanPermission;
		
		loanedTo = null;
	}
	
	public int getId() {
		return id;
	}
	
	boolean reservable() {
		return loanPermission != LoanPermission.REFERENCE_ONLY;
	}
}
